package com.aaa.hospital.service.impl;

import com.aaa.hospital.mapper.RegisterMapper;
import com.aaa.hospital.pojo.domain.Info;
import com.aaa.hospital.pojo.domain.Kes;
import com.aaa.hospital.pojo.vo.RegisterVo;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author:张海金
 * Description:T0D0
 * DateTime:2022/2/24 13:40
 **/
@Service
public class RegisterServiceImpl implements RegisterService {

    @Autowired
    private RegisterMapper registerMapper;

    @Override
    public AjaxResult getks() {

        List<Kes> kes = registerMapper.getks();

        return AjaxResult.success(kes);
    }

    @Override
    public AjaxResult waike() {
        List<Kes> kes1s = registerMapper.waike();
        return AjaxResult.success(kes1s);
    }

    @Override
    public AjaxResult guke() {
        List<Kes> kes2s = registerMapper.guke();
        return AjaxResult.success(kes2s);
    }

    @Override
    public AjaxResult xinlike() {
        List<Kes> kes3s = registerMapper.xinlike();
        return AjaxResult.success(kes3s);
    }

    @Override
    public AjaxResult breathing(Integer id) {
        List<Info> docList = registerMapper.breathing(id);
        return AjaxResult.success(docList);
    }

    @Override
    public AjaxResult getName(Integer id) {
        List<Info> infos = registerMapper.getName(id);
        return AjaxResult.success(infos);
    }

    @Override
    public AjaxResult getNameOne(Integer id) {
        List<Info> infos1 = registerMapper.getNameOne(id);
        return AjaxResult.success(infos1);
    }

    @Override
    public AjaxResult getNameTwo(Integer id) {
        List<Info> infos2 = registerMapper.getNameTwo(id);
        return AjaxResult.success(infos2);
    }

    @Override
    public AjaxResult getNameThree(Integer id) {
        List<Info> infos3 = registerMapper.getNameThree(id);
        return AjaxResult.success(infos3);
    }

    @Override
    public AjaxResult getSurgery(Integer id) {
        List<Info> getSurgery = registerMapper.getSurgery(id);
        return AjaxResult.success(getSurgery);
    }

    @Override
    public AjaxResult getSurgeryOne(Integer id) {
        List<Info> getSurgeryOne = registerMapper.getSurgeryOne(id);
        return AjaxResult.success(getSurgeryOne);
    }

    @Override
    public AjaxResult getSurgeryTwo(Integer id) {
        List<Info> getSurgeryTwo = registerMapper.getSurgeryTwo(id);
        return AjaxResult.success(getSurgeryTwo);
    }

    @Override
    public AjaxResult getSurgeryThree(Integer id) {
        List<Info> getSurgeryThree = registerMapper.getSurgeryThree(id);
        return AjaxResult.success(getSurgeryThree);
    }

    @Override
    public AjaxResult getBone(Integer id) {
        List<Info> getBone = registerMapper.getBone(id);
        return AjaxResult.success(getBone);
    }

    @Override
    public AjaxResult getBoneOne(Integer id) {
        List<Info> getBoneOne = registerMapper.getBoneOne(id);
        return AjaxResult.success(getBoneOne);
    }

    @Override
    public AjaxResult getBoneTwo(Integer id) {
        List<Info> getBoneTwo = registerMapper.getBoneTwo(id);
        return AjaxResult.success(getBoneTwo);
    }

    @Override
    public AjaxResult getBoneThree(Integer id) {
        List<Info> getBoneThree = registerMapper.getBoneThree(id);
        return AjaxResult.success(getBoneThree);
    }

    @Override
    public AjaxResult getHeart(Integer id) {
        List<Info> getHeart = registerMapper.getHeart(id);
        return AjaxResult.success(getHeart);
    }

    @Override
    public AjaxResult getHeartOne(Integer id) {
        List<Info> getHeartOne = registerMapper.getHeartOne(id);
        return AjaxResult.success(getHeartOne);
    }

    @Override
    public AjaxResult getHeartTwo(Integer id) {
        List<Info> getHeartTwo = registerMapper.getHeartTwo(id);
        return AjaxResult.success(getHeartTwo);
    }

    @Override
    public AjaxResult getHeartThree(Integer id) {
        List<Info> getHeartThree = registerMapper.getHeartThree(id);
        return AjaxResult.success(getHeartThree);
    }

    @Override
    public AjaxResult addRegister(RegisterVo registerVo) {

        registerVo.setState(0);

        System.out.println("---------------" + registerVo);

        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduce(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }


    }

    @Override
    public AjaxResult addRegisterOne(RegisterVo registerVo) {
        registerVo.setState(0);

        System.out.println("---------------" + registerVo);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceOne(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }

    }

    @Override
    public AjaxResult addRegisterTwo(RegisterVo registerVo) {
        registerVo.setState(0);
        System.out.println("---------------" + registerVo);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceTwo(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addRegisterThree(RegisterVo registerVo) {
        registerVo.setState(0);
        System.out.println("---------------" + registerVo);
        System.out.println(registerVo);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceThree(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addSurgery(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduce(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }

    }

    @Override
    public AjaxResult addSurgeryOne(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceOne(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addSurgeryTwo(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceTwo(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addSurgeryThree(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceThree(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addBone(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduce(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addBoneOne(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceOne(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addBoneTwo(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceTwo(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addBoneThree(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceThree(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addHeart(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduce(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addHeartOne(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceOne(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addHeartTwo(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceTwo(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

    @Override
    public AjaxResult addHeartThree(RegisterVo registerVo) {
        registerVo.setState(0);
        int i = registerMapper.addRegister(registerVo);

        if(  i > 0){
            Integer id = registerVo.getId();
            int a = registerMapper.reduceThree(id);
            return AjaxResult.success();
        }else {
            return AjaxResult.fail("预约失败，请重试");
        }
    }

}
